﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication6
{
    public partial class AddServerScreen : Form
    {
        public AddServerScreen()
        {
            InitializeComponent();
        }

        private Sync.Library.Server server;

        public Sync.Library.Server Server
        {
            get { return server; }
        }

        private void AddServerScreen_Load(object sender, EventArgs e)
        {
            server = new Sync.Library.Server();
            SetBindings();
        }

        private void SetBindings()
        {
            tbServerDesc.DataBindings.Clear();
            tbIP.DataBindings.Clear();
            tbPort.DataBindings.Clear();
            tbInstance.DataBindings.Clear();
            //tbUserID.DataBindings.Clear();
            //tbPassword.DataBindings.Clear();

            tbServerDesc.DataBindings.Add("Text", server, "Description");
            tbIP.DataBindings.Add("Text", server, "IP");
            tbPort.DataBindings.Add("Text", server, "Port");
            tbInstance.DataBindings.Add("Text", server, "InstanceName");
            tbUserID.DataBindings.Add("Text", server, "UserID");
            tbPassword.DataBindings.Add("Text", server, "Password");
            tbDBName.DataBindings.Add("Text", server, "DBName");
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.OK;
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }
}
